package com.changli07._interface.exer1;

public class EatableTest {
    public static void main(String[] args) {
        Eatable [] eats = new Eatable[3];
        eats[0] = new Chinese ();
        eats[1] = new American ();
        eats[2] = new Indian();
        for (int i = 0; i < eats.length; i++) {
            eats[i].eat();

        }
    }

}

//接口  Eatable

interface Eatable {
    void eat();
}
class Chinese implements Eatable {
    public void eat() {
        System.out.println("用筷子吃饭");
    }
}
class American implements Eatable {
    public void eat (){
        System.out.println("用刀叉吃饭");
    }
}
class Indian implements Eatable {
    public void eat (){
        System.out.println("用手抓饭");
    }
}

